"""
销量预测接口
"""
# sfb
import json
from fastapi import APIRouter
from pydantic import BaseModel

# zjb

from core import pySalesRank
from core.utils import SelfJSONResponse


rank = APIRouter(tags=["排行榜"], prefix="/rankAction")


# @Introduce: 查询销量排行榜
# @Param: index - 索引值, year - 年份, month - 月份 （1-轿车, 2-SUV, 3-MPV及商用车）
# @Return data
@rank.get("/getSalesRank", summary="获取销量排行榜")
async def getSalesRank(index: str, year: str, month: str):
    results = pySalesRank(index, year, month)
    return SelfJSONResponse(code=200,
                            data=results,
                            msg="查询成功！")
